<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input id="m" type="text" />
    <select name="" id="opt">
        <option value="s1">+</option>
        <option value="s2">-</option>
        <option value="s3">*</option>
        <option value="s4">/</option>
        <option value="s5">%</option>
    </select>
    <input id="n" type="text" />
    <input type="button" value="=" onclick="sum2()">
    <input id="result" type="text" />
    <script>
        function sum2() {
            var m = document.getElementById("m").value;
            var n = document.getElementById("n").value;
            var option = document.getElementById("opt");
            if (option.value =="s1") {
                result.value = Math.round(Number(m) + Number(n));
            }
            else if (option.value == "s2") {
                result.value = Math.round(Number(m) - Number(n));
            }
            else if (option.value == "s3") {
                result.value = Math.round(Number(m) * Number(n));
            }
            else if (option.value =="s4") {
                result.value = Math.round(Number(m) / Number(n));
            }
            else {
                result.value = Math.round(Number(m) % Number(n));
            }
        }
    </script>

</body>
</html>